﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using D3DSS.DataContract;
using D3DSS.Entity;

namespace D3DSS.FormUI
{
    public static class Program
    {
        /// <summary>
        /// 主窗口句柄
        /// </summary>
        public static IntPtr MainHandle { get; set; }

        /// <summary>
        /// 窗体消息结果
        /// </summary>
        public static DialogResult Result { get; set; }

        /// <summary>
        /// 通行证
        /// </summary>
        public static Token Token { get; set; }

        /// <summary>
        /// 统计单
        /// </summary>
        public static StatisticsOrder StatisticsOrder { get; set; }

        /// <summary>
        /// 统计单窗体
        /// </summary>
        public static frmStatisticsOrder FormStatisticsOrder { get; set; }

        /// <summary>
        /// 注册和登录窗体
        /// </summary>
        public static frmRegisterAndLogin FormRegisterAndLogin { get; set; }

        /// <summary>
        /// 查询统计窗体
        /// </summary>
        public static frmQueryStatistics FormQueryStatistics { get; set; }

        /// <summary>
        /// 设置窗体
        /// </summary>
        public static frmSetup FormSetup { get; set; }

        /// <summary>
        /// 主窗体
        /// </summary>
        public static frmMain FormMain { get; set; }

        /// <summary>
        /// 升级窗体
        /// </summary>
        public static frmUpdate FormUpdate { get; set; }

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            FormUpdate = new frmUpdate();
            FormUpdate.DialogResult = DialogResult.No;
            FormUpdate.ShowDialog();
            if (FormUpdate.DialogResult == DialogResult.OK)
            {
                FormRegisterAndLogin = new frmRegisterAndLogin();
                FormRegisterAndLogin.ShowDialog();
                if (FormRegisterAndLogin.DialogResult == DialogResult.OK)
                {
                    FormMain = new frmMain();
                    Application.Run(FormMain);
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
        }
    }
}
